package com.lagou.service;

import com.lagou.dao.UserDao;
import com.lagou.domain.User;

import java.sql.SQLException;

public class UserService {
    UserDao userDao;

    public UserService(){
        userDao = new UserDao();
    }
    public User login(String username, String password) throws SQLException {
        Boolean success = userDao.login(username, password);
        if(success){
            User user = new User(username, password);
            return user;
        }
        else
            return null;
    }

    public void add(User user) throws SQLException {
        userDao.add(user);
    }
}
